<template>
	<!-- 新增 -->
	<el-dialog
		title=""
		:visible.sync="dialog"
		width="300px">
		<!-- 内容 -->
		<div class="recommend">
			<h3 class="title">置顶至：</h3>
			<div class="group">
				<el-radio v-model="radio" label="1">全部位置</el-radio>
			</div>
			<div class="group">
				<el-radio v-model="radio" label="2">首页位置</el-radio>
			</div>
			<div class="group">
				<el-radio v-model="radio" label="3">热搜位置</el-radio>
			</div>
		</div>
		<!-- 提交 -->
		<div class="flex flex-end">
			<div class="btn">
				<el-button
					@click="dialog = false"
					size="small">取消
				</el-button>
			</div>
			<div class="btn">
				<el-button
					type="primary"
					@click="submit()"
					size="small">确定
				</el-button>
			</div>
		</div>
	</el-dialog>
</template>

<script>
export default {
	props:["ifShow","formData","type"],
	watch:{
		ifShow(val){
			this.dialog = true;
		}
	},
	data() {
		return {
			dialog:false,
			radio:'1'
		};
	},
	methods:{
		//提交
		submit:function(){
			HTTP('contentRecommendTop', {
				contentType:this.formData.contentType?this.formData.contentType:this.type,
				uid:this.formData.uid?this.formData.uid:this.formData.contentUid, //列表是uid，详情是contentUid 很蛋疼
				status:this.radio,
			})
			.then(res=>{
				if(res.code == 200){
					this.common.msg('置顶成功');
					this.dialog = false;
					this.$emit('httpSuccess',1);
				}
				else{
					this.common.msg(res.msg,'error');
				}
			})
		}
	},
	mounted(){

	}
};
</script>

<style lang="scss" scoped>
	// 饿了么样式
	/deep/ .el-dialog__header{
		text-align: center;
	}
	/deep/ .el-textarea__inner{
		height: 100px;
	}
	/deep/ .el-dialog__body{
		padding: 20px 30px;
	}

	.recommend{
		padding: 10px 30px;
		.title{
			font-weight: bold;
			margin-bottom: 10px;
			height: 30px;
		}
		.group{
			width: 100%;
			margin: 14px 0;
		}
	}

	.btn{
		margin: 20px 0 0 20px;
	}
</style>
